﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpDX;
using SharpDX.Direct2D1;
using Write = SharpDX.DirectWrite;

namespace SFSpacefight
{
	public abstract class Control
	{
		protected static Write.Factory writefac = new Write.Factory();
		protected SolidColorBrush darkbrush;
		protected SolidColorBrush mediumbrush;
		protected SolidColorBrush lightbrush;
		protected DrawingRectangleF layoutrect;
		protected Write.TextFormat format;
		protected string text;
		protected float alpha, oldalpha; //out of 1

		public Control(RenderTarget target)
		{
			darkbrush = new SolidColorBrush(target, new Color4(0.1f, 0.1f, 0.1f, 1f));
			mediumbrush = new SolidColorBrush(target, new Color4(0.5f, 0.5f, 0.5f, 1f));
			lightbrush = new SolidColorBrush(target, new Color4(0.9f, 0.9f, 0.9f, 1f));

            format = new Write.TextFormat(writefac, "Tahoma", Write.FontWeight.Thin, Write.FontStyle.Normal, Write.FontStretch.UltraCondensed, 16);
            format.TextAlignment = Write.TextAlignment.Center;
            format.ParagraphAlignment = Write.ParagraphAlignment.Center;
		}
		public void ChangeText(string newtext)
		{
			text = newtext;
		}
		public abstract GameState Loop(int mousex, int mousey, bool clicked);
		public abstract void Draw(RenderTarget target, double percent);
	}
}
